from django import template
from l2ldjango.apps.mailmanagement.models import *


def getMessageCount(request):
	if request.user.id:
		mailto=request.user.id
  		inbx=mail.objects.filter(mail_to=mailto,mail_status_inbox='ACTIVE',is_read=0)
  		return {'msg_count':len(inbx)}
	else:
		inbox_messages_count=0
		return {'msg_count':inbox_messages_count}

register = template.Library()
register.inclusion_tag('mailmanagement/get_message_count.html')(getMessageCount)


